﻿@{
	ViewBag.Title = "欢迎你";
	int id = Convert.ToInt32(ViewContext.RouteData.Values["id"]);
}
<vc:change-user-name id="id"></vc:change-user-name>
<hr />
<div class="row">
	<div class="col-md-5">
		<div class="card mb-3">
			<div class="card-body">
				<div class="d-flex mt-3">
					<h5>联系方式：</h5>
					<div class="ml-auto">
						<button zyf-contact-edit hidden zyf-shown-userId="@id" type="button"  class="btn btn-sm btn-primary" onclick="editContact(@id)">修改</button>
						<button zyf-contact-view hidden zyf-shown-logon type="button" class="btn btn-sm btn-primary" onclick="showContact(@id)">查看</button>
					</div>
				</div>
				<div class="d-flex mt-3">
					<h5>密码：</h5>
					<div class="ml-auto">
						<button zyf-contact-edit hidden zyf-shown-userId="@id" type="button" class="btn btn-sm btn-primary" onclick="editPwd(@id)">修改</button>
					</div>
				</div>
				<p class="small text-info">仅本人能修改</p>
			</div>
		</div>
	</div>
</div>

<script>

	function editContact(id) {
		$.ajax({
			url: "/Contact/_Edit/" + id,
			success: function (data) {
				showModal('修改联系方式', data)
			},
			error: JqueryAjaxError
		})
	}

	function showContact(id) {
		$.ajax({
			url: "/Contact/_Of?userId=" + id,
			success: function (data) {
				showModal('请尽快主动联系求助人', data)
			},
			error: JqueryAjaxError
		})
	}

	function editPwd() {
		$.ajax({
			url: "/Pwd/Edit",
			success: function (data) {
				showModal('修改密码', data)
			},
			error: JqueryAjaxError
		})
	}
</script>
